package myjava.io;

import java.io.*;

/**
 * @author Yancy
 * @program springioctest
 * @create 2020-11-19
 */
public class Objectser implements Serializable {

  public static void main(String[] args) {
    //
      Student student = new Student(1,"张三","CSD");

      try {
          FileOutputStream fo = new FileOutputStream("myFile.text");
          ObjectOutputStream oo = new ObjectOutputStream(fo);
          oo.writeObject(student);
          oo.close();
      } catch (FileNotFoundException e) {
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
  }
}
